﻿using Microsoft.Extensions.Configuration;
using System.Data;

namespace MiniFox.Data.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public class ParameterSetting
    {
        /// <summary>
        /// 
        /// </summary>
        public ParameterSetting() 
        {
            this.Type = "System.String";
            this.Precision = byte.MinValue;
            this.Scale = byte.MinValue;
            this.Size = ushort.MinValue;
            this.Nullable = true;
            this.DefaultValue = null;
        }

        /// <summary>
        /// 名称
        /// </summary>
        [ConfigurationKeyName("name")]
        public string Name
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("paraName")]
        public string ParameterName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("type")]
        public string Type
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        public Type ClrType
        {
            get { return System.Type.GetType(Type, true, true); }
        }
        
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("direction")]
        public ParameterDirection Direction
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("nullable")]
        public bool Nullable
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("defaultValue")]
        public string DefaultValue
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("precision")]
        public byte Precision
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("scale")]
        public byte Scale
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("size")]
        public ushort Size
        {
            get;
            set;
        }

    }

}
